package com.yfp.device.mapper;

import com.yfp.device.domain.SysUser;
import com.yfp.device.domain.SysUserExample;

import java.util.List;

import org.apache.ibatis.annotations.Param;

public interface SysUserMapper {
    long countByExample(SysUserExample example);

    int deleteByExample(SysUserExample example);

    int deleteByPrimaryKey(Long userId);

    int insert(SysUser record);

    int insertSelective(SysUser record);

    List<SysUser> selectByExample(SysUserExample example);

    SysUser selectByPrimaryKey(Long userId);

    int updateByExampleSelective(@Param("record") SysUser record, @Param("example") SysUserExample example);

    int updateByExample(@Param("record") SysUser record, @Param("example") SysUserExample example);

    int updateByPrimaryKeySelective(SysUser record);

    int updateByPrimaryKey(SysUser record);

    /**
     * 根据角色和用户信息获取用户
     *
     * @param userName  用户名
     * @param machineSn 机器编号
     * @return 用户
     */
    SysUser selectByMachineAndUser(@Param("userName") String userName, @Param("machineSn") String machineSn);

    /**
     * 通过用户名获取用户
     *
     * @param userName 用户名
     * @return 用户
     */
    SysUser selectByUserName(@Param("userName") String userName);

    /**
     * 根据角色Key和机器编号获取用户信息
     *
     * @param roleKey   角色KEY
     * @param machineSn 机器编号
     * @param userName  用户名
     * @return 用户
     */
    SysUser selectCommonUserByMachineSn(@Param("roleKey") String roleKey, @Param("machineSn") String machineSn, @Param("userName") String userName);
}